package main

import (
	"fmt"
	"strings"
)

func solution(s string) string {
	// 去除前导零
	s = strings.TrimLeft(s, "0")
	if s == "" {
		s = "0"
	}

	// 分离整数和小数部分
	parts := strings.Split(s, ".")
	intPart := parts[0]
	var decPart string
	if len(parts) > 1 {
		decPart = "." + parts[1]
	}

	// 格式化整数部分
	n := len(intPart)
	if n <= 3 {
		return intPart + decPart
	}

	var result []byte
	for i := 0; i < n; i++ {
		if (n-i)%3 == 0 && i != 0 {
			result = append(result, ',')
		}
		result = append(result, intPart[i])
	}

	return string(result) + decPart
}

func main() {
	fmt.Println(solution("1294512.12412") == "1,294,512.12412")   // true
	fmt.Println(solution("0000123456789.99") == "123,456,789.99") // true
	fmt.Println(solution("987654321") == "987,654,321")           // true
}


